import request from './request'
const lang = localStorage.getItem('lang') || 'cn'

export default {
  // 登录
  login: (params = {}) =>
    request.post(`/remote1/api/user/dapp?lang=${lang}`, params),

  // 注册
  register: (params = {}) => request.post('/remote1/api/user/bind', params),

  // 获取共识列表
  getLevelList: (params = {}) =>
    request.post('/remote1/api/user/level', params),

  // 创建共识订单
  createLevelOrder: (params = {}) =>
    request.post('/remote1/api/order/sign', params),

  // 获取共识详情
  getLevelDetail: (params = {}) =>
    request.post('/remote1/api/order/cur', params),

  // 获取共识明细
  getLevelOrderList: (params = {}) =>
    request.post('/remote1/api/order/lst', params),

  // 获取市场详情
  getMarketDetail: (params = {}) =>
    request.post('/remote1/api/user/market', params),

  // 获取收益列表
  getProfitList: (params = {}) =>
    request.post('/remote1/api/user/flow', params),

  // 提现
  withdraw: (params = {}) => request.post('/remote1/api/user/cash', params),

  // 获取PC余额
  getPcBalance: (params = {}) =>
    request.get(
      `/remote2/cosmos/bank/v1beta1/balances/${params.address}/by_denom?denom=uplugcn`
    ),
}
